package com.cms.framework.context;

public class PageContext {
	public static ThreadLocal<Integer> cuurentPage = new ThreadLocal<Integer>();
	
	public static ThreadLocal<Integer> pageSize = new ThreadLocal<Integer>();
	
	public static final int defualtCuurentPage = 1; 
	
	public static final int defualtPageSize = 1; 
	
	public static Integer getCuurentPage(){
		return cuurentPage.get();
	}
	
	public static Integer getPageSize(){
		return pageSize.get();
	}
	
	public static void setCuurentPage(Integer value){
		if(value == null){
			cuurentPage.set(defualtCuurentPage);
			return;
		}
		cuurentPage.set(value);
	}
	
	public static void setPageSize(Integer value){
		if(value == null){
			pageSize.set(defualtPageSize);
			return;
		}
		pageSize.set(value);
	}

	public static void init(Integer cuurentPage2, Integer pageSize2) {
		setCuurentPage(cuurentPage2);
		setPageSize(pageSize2);
	}
}
